import axios  from 'axios';
import  createLoading  from  '@/utils/createLoading.js'
let loaidng
function getRepairClienRecords() {
    return axios.get(`https://gitee.com/api/v5/repos/belovedLYC/client/commits?page=1&per_page=50`,{
        params:{
                'access_token': import.meta.env.VITE_APP_GIT_ACCESS_TOKEN,
        }
    })
}
function getRepairServerRecords() {
    return axios.get(`https://gitee.com/api/v5/repos/belovedLYC/nodejs-integration-solutions/commits?page=1&per_page=50`,{
        params:{
                'access_token': import.meta.env.VITE_APP_GIT_ACCESS_TOKEN
        }
    })
}
export function getRepairRecords() {
    loaidng =createLoading({
        text:'正在拉取修复日志'
    })
    return axios.all([
        getRepairClienRecords(),           
        getRepairServerRecords()           
    ])
    .then(axios.spread((repairRecordsResponse, repairRecordResponse) => {
        //合并两个仓库的commits
        loaidng.cleanFn(10)
        loaidng  = null
        return [...repairRecordsResponse.data,... repairRecordResponse.data]
    }))
    .catch(error => {
        console.error('请求失败:', error);
    });
}